package model;
import com.jfinal.plugin.activerecord.Db;

import model.base.BaseStaff;

@SuppressWarnings("serial")
public class Staff extends BaseStaff<Staff> {
    public static final Staff dao = new Staff().dao();
    

	public Staff findFirstByIdcardAndServicerId(String idcard , Long servicerId){
        return this.findFirst(" SELECT ts.* FROM t_staff ts WHERE ts.idcard = ? AND ts.servicerId = ?  LIMIT 1 " , idcard , servicerId);
    }

	public Staff findFirstByServicerIdAndMobile(Long servicerId , String mobile){
        return this.findFirst(" SELECT ts.* FROM t_staff ts WHERE ts.servicerId = ? AND ts.mobile = ?  LIMIT 1 " , servicerId , mobile);
    }
	
	public Staff findFirstByWxuser(Wxuser wxuser){
        return this.findFirstByServicerIdAndMobile(wxuser.getCompanyId(), wxuser.getMobile());
    }
	
	public void deleteByServicerId(Long id) {
		Db.update(" DELETE FROM t_staff WHERE servicerId = ? " , id);
	}
}
